<template>
  <el-date-picker
    v-model="Search.projectStarttime"
    type="datetime"
    placeholder="项目开始时间"
  />
  &nbsp;&nbsp;&nbsp;&nbsp;
  <el-date-picker
    v-model="Search.projectEndtime"
    type="datetime"
    placeholder="项目结束时间"
  />
  <br /><br />
  <el-autocomplete
    style="width: 220px"
    v-model="Search.projectPerson"
    :fetch-suggestions="querySearchAsync1"
    placeholder="项目负责人"
  ></el-autocomplete>
  <br /><br />
  <el-button @click="ProjectSearch" type="primary">确定</el-button>
</template>

<script>
export default {
  props: {},
  data() {
    return {
      UserInfor: "",
      Search: {
        projectStarttime: null,
        projectEndtime: null,
        projectPerson: "",
      },
    };
  },
  created() {
    this.http.get("api/User/GetSecretaryListAsync").then((res) => {
      console.log(res);
      this.UserInfor = res.data;
    });
  },
  methods: {
    querySearchAsync1(queryString, cb) {
      var restaurants = this.UserInfor;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      });
    },
    createStateFilter(queryString) {
      return (state) => {
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1
        );
      };
    },
    ProjectSearch() {
      debugger;
      this.$emit("passfunction", this.Search);
    },
  },
};
</script>
